var t = getApp();

Page({
    data: {
        page: 1,
        isLoadMore: !0,
        total_page: 0,
        listData: [],
        networkLoading: !1,
        picture_list: [],
        pic_src_list: []
    },
    onLoad: function(t) {
        t.id && t.id > 0 && wx.setNavigationBarTitle({
            title: "个人捐赠项目图片详情"
        }), this.getListData();
    },
    onReady: function() {},
    initData: function() {
        this.setData({
            page: 1,
            total_page: 0,
            isLoadMore: !0,
            networkLoading: !1
        });
    },
    getListData: function() {
        var a = this;
        this.initData();
        var i = t.getNetAddresss("plugin.present-project.frontend.project.getProjectAll"), e = {};
        this.options.id && 0 != this.options.id && (i = t.getNetAddresss("plugin.present-project.frontend.project.getPersonAll"), 
        e.id = this.options.id), this.options.time && "" != this.options.time && (e.time = this.options.time), 
        t._postNetWork({
            url: i,
            data: e,
            success: function(i) {
                var e = i.data;
                if (1 != e.result) return t.tips(e.msg);
                a.data.total_page = e.data.list.last_page, a.data.total_page || (a.data.total_page = 0);
                var o = [], s = [];
                e.data.list.data.forEach(function(t) {
                    t.change_img.forEach(function(a) {
                        var i = {
                            name: t.title,
                            url: a,
                            id: t.id
                        };
                        o.push(i), s.push(a);
                    });
                }), a.setData({
                    picture_list: o,
                    pic_src_list: s,
                    networkLoading: !0
                });
            }
        });
    },
    _getMoreData: function() {
        var a = this;
        if (this.data.isLoadMore = !1, !(this.data.page >= this.data.total_page)) {
            this.data.page += 1;
            var i = t.getNetAddresss("plugin.present-project.frontend.project.getProjectAll"), e = {
                page: this.data.page
            };
            this.options.id && 0 != this.options.id && (i = t.getNetAddresss("plugin.present-project.frontend.project.getPersonAll"), 
            e.id = this.options.id), this.options.time && "" != this.options.time && (e.time = this.options.time), 
            t._postNetWork({
                url: i,
                data: e,
                success: function(t) {
                    var i = t.data;
                    if (a.data.isLoadMore = !0, 1 === i.result) {
                        var e = i.data.list.data, o = a.data.picture_list, s = a.data.pic_src_list;
                        e.forEach(function(t) {
                            t.change_img.forEach(function(a) {
                                var i = {
                                    name: t.title,
                                    url: a,
                                    id: t.id
                                };
                                o.push(i), s.push(a);
                            });
                        }), a.setData({
                            picture_list: o,
                            pic_src_list: s
                        });
                    } else a.data.page = a.data.page - 1, a.data.isLoadMore = !1;
                }
            });
        }
    },
    handPictureImagePreview: function(t) {
        var a = t.currentTarget.dataset.src;
        console.log(a), wx.previewImage({
            urls: this.data.pic_src_list,
            current: a
        });
    },
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        this.data.isLoadMore ? this._getMoreData() : console.log("没有更多数据");
    },
    onShareAppMessage: function() {}
});